package com.example.hssmgs.Student;

import android.app.Activity;
import android.content.ContentValues;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.annotation.Nullable;

import com.example.hssmgs.R;

public class left_msg extends Activity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.left_msg);

        final EditText editText = findViewById(R.id.et_message);
        Button button_submit = findViewById(R.id.button_submit);
        Button back_st_1 = findViewById(R.id.back_st_1);



        button_submit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(editText.getText().toString().equals(""))
                {
                    Toast.makeText(left_msg.this,"留言不可以为空",Toast.LENGTH_SHORT).show();
                }
                else
                {
//                    ContentValues contentValues = new ContentValues();
//                    contentValues.put("student_id",getIntent().getStringExtra("student_id"));
//                    contentValues.put("message",editText.getText().toString());
//
//                    new CommonDatabase().getSqliteObject(left_msg.this,"test_db").
//                            insert("message",null,contentValues);
//                    Toast.makeText(left_msg.this,"留言成功！",Toast.LENGTH_SHORT).show();
                    finish();
                }


            }
        });

        back_st_1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }
}
